home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGASIC / BASFILES.LZH / DIALOG.BAS < prev    next >
BASIC Source File  |  1988-09-10  |  3KB  |  146 lines

  1. '$INCLUDE:'QBTOOLS.INC'
  2. '' '$INCLUDE: 'qbtools2.inc'
  3.  
  4.  
  5. 'DIM Ques$(10)
  6.  
  7. 'Ques$(1) = "This is a test to see how the"
  8. 'Ques$(2) = "dialog box works. The next line is the input."
  9. 'Ques$(3) = "It is important to see how this follows on from the"
  10. 'Ques$(4) = "input. Both these lines, and those before hand"
  11. 'Ques$(5) = "should be left justified."
  12. 'Ques$(6) = "Heres More"
  13. 'Ques$(7) = "Heres More again"
  14.  
  15. 'Before% = 4
  16. 'After% = 3
  17. 'sect% = 2
  18.  
  19. 'Ffgd% = 7
  20. 'Fbgd% = 0
  21. 'Gfgd% = 7
  22. 'Gbgd% = 0
  23.  
  24. 'Length% = 62
  25.  
  26. 'DialogBox Ques$(), Before%, After%, Length%, Ffgd%, Fbgd%, Gfgd%, Gbgd%, sect%, Answer$, Ek%
  27.  
  28. 'FOR sect% = 0 TO 2
  29.  
  30. 'Ques$(1) = "Enter your FIRST name."
  31. 'Ques$(2) = "The data file will also"
  32. 'Ques$(3) = "receive this name."
  33.  
  34. 'Before% = 1
  35. 'After% = 2
  36.  
  37. 'Ffgd% = 7
  38. 'Fbgd% = 0
  39. 'Gfgd% = 7
  40. 'Gbgd% = 0
  41.  
  42. 'Length% = 12
  43.  
  44. 'DialogBox Ques$(), Before%, After%, Length%, Ffgd%, Fbgd%, Gfgd%, Gbgd%, sect%, Answer$, Ek%
  45.  
  46. 'NEXT sect%
  47.  
  48. 'END
  49.  
  50. SUB DialogBox (Ques$(), Before%, After%, Length%, Ffgd%, Fbgd%, Gfgd%, Gbgd%, sect%, Answer$, Ek%)
  51.  
  52.     '
  53.     '  Before   -  Textlines for question before input
  54.     '  After    -  Textlines for question after input
  55.     '  Length   -  Length of input
  56.     '  Ffgd     -  Frame foreground
  57.     '  Fbgd     -  Frame background
  58.     '  Gfgd     -  General Foreground
  59.     '  Gbgd     -  General background
  60.     '  Sect     -  Section of the screen to display on
  61.     '              0=Top,1=Center,2=Bottom
  62.     '  Answer   -  Answer string
  63.     '  Ek       -  Exit Key
  64.     '              5=Return, 7=ESC
  65.     '$DYNAMIC
  66.  
  67.     REDIM Saver%(2000)
  68.  
  69.     BandA% = Before% + After%
  70.  
  71.     height% = BandA%                    '  Pure Text height
  72.     height% = height% + 5               '  4 lines of drawing + input line
  73.  
  74.     IF height% > 25 THEN
  75.         EXIT SUB
  76.     END IF
  77.  
  78.     IF Length% < 1 THEN
  79.         EXIT SUB
  80.     END IF
  81.  
  82.     SELECT CASE sect%
  83.         CASE 0
  84.             Begin% = 1
  85.         CASE 1
  86.             Begin% = (25 - height%) / 2
  87.         CASE 2
  88.             Begin% = (25 - height%) + 1
  89.         CASE ELSE
  90.             EXIT SUB
  91.     END SELECT
  92.  
  93.     SaveScreen Saver%(1)
  94.  
  95.     Txwd% = Length%
  96.  
  97.     FOR j% = 1 TO BandA%
  98.         Trim Ques$(j%)
  99.         IF LEN(Ques$(j%)) > Txwd% THEN
  100.             Txwd% = LEN(Ques$(j%))
  101.         END IF
  102.     NEXT j%
  103.  
  104.     BoxWidth% = Txwd% + 4
  105.     LeftCol% = (80 - BoxWidth%) / 2
  106.     Wid% = BoxWidth%
  107.     FrameType% = 3
  108.     FrmFgd% = Ffgd%
  109.     FrmBgd% = Fbgd%
  110.     Fill% = 1
  111.     FillFgd% = Gfgd%
  112.     FillBgd% = Gbgd%
  113.  
  114.     DrawBox Begin%, LeftCol%, Wid%, height%, FrameType%, FrmFgd%, FrmBgd%, Fill%, FillFgd%, FillBgd%
  115.  
  116.     Attrib1% = Attributes%(Gfgd%, Gbgd%, 0, 0)
  117.     Attrib2% = Attributes%(Ffgd%, Fbgd%, 0, 0)
  118.  
  119.     FOR j% = 1 TO Before%
  120.         text$ = Ques$(j%)
  121.         ColorPrint text$, Begin% + j%, LeftCol% + 2, Attrib1%
  122.     NEXT j%
  123.  
  124.     FOR j% = 1 TO After%
  125.         text$ = Ques$(j% + Before%)
  126.         ColorPrint text$, Begin% + Before% + 3 + j%, LeftCol% + 2, Attrib1%
  127.     NEXT j%
  128.  
  129.     Istart% = (80 - Length%) / 2
  130.  
  131.  
  132.     DrawBox Begin% + Before% + 1, Istart% - 1, Length% + 2, 3, 1, FrmFgd%, FrmBgd%, Fill%, FillFgd%, FillBgd%
  133.  
  134.     Xc% = LeftCol% + 2
  135.  
  136.     Yc% = Begin% + Before% + 2
  137.  
  138.  
  139.  
  140.     TextInput 0, 0, 0, 0, 1, 0, 1, Length%, Answer$, Istart%, Yc%, FrmFgd%, FrmBgd%, 0, Ek%
  141.  
  142.     RestoreScreen Saver%(1)
  143.  
  144. END SUB
  145.  
  146.